package com.triones.yjj.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.triones.yjj.entity.OrderDO;
import com.triones.yjj.entity.bo.OrderListParams;
import com.triones.yjj.entity.bo.WxStaffMemberOrderParams;
import com.triones.yjj.entity.vo.*;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 订单 mapper 接口
 *
 * @Author: triones
 */
public interface OrderMapper extends BaseMapperPlus<OrderMapper, OrderDO, OrderVO> {

    /**
     * 获取用户支付总金额
     * @param memberId
     * @param userId
     * @return
     */
    String getRealityPayAmountTotal(@Param("memberId") Long memberId,@Param("userId") Long userId);

    /**
     * 获取已退款总金额
     * @param memberId
     * @param userId
     * @return
     */
    String getRefundTotal(@Param("memberId") Long memberId,@Param("userId") Long userId);

    /**
     * 获取客户订单列表
     * @param build
     * @param wrapper
     * @return
     */
    Page<MemberOrderListVO> orderPageList(@Param("page") Page<Object> build,@Param(Constants.WRAPPER) QueryWrapper<OrderDO> wrapper);

    /**
     * 获取订单列表（分页）
     * @param build
     * @param wrapper
     * @return
     */
    Page<OrderListVO> pageList(@Param("page") Page<OrderListVO> build,@Param(Constants.WRAPPER) QueryWrapper<OrderDO> wrapper);

    /**
     * 统计正常订单的支付总金额
     * @param userId
     * @return
     */
    String statsAmountTotal(@Param("userId") Long userId);

    /**
     * 统计正常订单扣除金额
     * @param userId
     * @return
     */
    String statsDeductTotalAmount(@Param("userId") Long userId);

    List<WxMemberOrderVO> getMemberOrderList(@Param("memberId") Long memberId);


    WxMemberInviteRewardVO getMemberRewardInfo(@Param("memberId") Long memberId);

    List<ActivityOrderUserVO> getActivityOrderMemberList(@Param("activityId") Long activityId);

    List<ActivityOrderUserVO> getActivityAllOrderList(@Param("activityId") Long activityId);

    /**
     * 获取客户某个活动带来的订单列表（分页）
     * @param build
     * @param wrapper
     * @return
     */
    Page<OrderListVO> bringOrderPageList(@Param("page") Page<Object> build,@Param(Constants.WRAPPER)  QueryWrapper<OrderDO> wrapper);

    /**
     * 查询最新支付订单
     * @param page
     * @param wrapper
     * @return
     */
    Page<ActivityOrderUserVO> getActivityPayOrderList(@Param("page") Page<OrderDO> page,@Param(Constants.WRAPPER)  QueryWrapper<OrderDO> wrapper);

    Page<WxVerificationOrderVO> getVerificationOrderList(@Param("page") Page<OrderDO> page,@Param(Constants.WRAPPER)  QueryWrapper<OrderDO> wrapper);

    Page<WxStaffOrderVO> getOrderList(@Param("page") Page<OrderDO> page,@Param(Constants.WRAPPER)  QueryWrapper<OrderDO> wrapper);

    ActivityOrderUserVO getOrderDetail(@Param("id") Long id);

    /**
     * 查询客户核销订单
     * @param activityId
     * @param memberId
     * @return
     */
    List<ActivityOrderUserVO> getMemberVerOrderList(@Param("activityId") Long activityId,@Param("memberId") Long memberId);

    /**
     * 查询员工客户订单列表
     * @param page
     * @param param
     * @return
     */
    Page<WxStaffMemberOrderVO> getStaffMemberOrderList(@Param("page") Page<Object> page,@Param("param") WxStaffMemberOrderParams param);

}
